package com.message.service;

import com.message.entity.MessageStructure;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Administrator on 2018/3/29 0029.
 */
@Service
public class MessageServiceImpl implements MessageService {
    @Autowired
    private ServiceMessageChannel serviceMessageChannel;

    @Override
    public boolean sendTestServiceMessage(MessageStructure messageStructure) {
        return serviceMessageChannel
                .outputTestService()
                .send(
                        MessageBuilder
                                .withPayload(messageStructure)
                                .build()
                );
    }

    @Override
    public boolean sendJenkinsMessage(MessageStructure messageStructure) {
        return serviceMessageChannel
                .outputIntegrationTesting()
                .send(
                        MessageBuilder
                                .withPayload(messageStructure)
                                .build()
                );
    }

}
